package com.ruoyi.myplayer.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.myplayer.mapper.PlayerSongMapper;
import com.ruoyi.myplayer.domain.PlayerSong;
import com.ruoyi.myplayer.service.IPlayerSongService;

import javax.annotation.Resource;

/**
 * 歌曲Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-09
 */
@Service
public class PlayerSongServiceImpl implements IPlayerSongService 
{
    @Resource
    private PlayerSongMapper playerSongMapper;

    /**
     * 查询歌曲
     * 
     * @param id 歌曲主键
     * @return 歌曲
     */
    @Override
    public PlayerSong selectPlayerSongById(Long id)
    {
        return playerSongMapper.selectPlayerSongById(id);
    }

    /**
     * 查询歌曲列表
     * 
     * @param playerSong 歌曲
     * @return 歌曲
     */
    @Override
    public List<PlayerSong> selectPlayerSongList(PlayerSong playerSong)
    {
        return playerSongMapper.selectPlayerSongList(playerSong);
    }

    /**
     * 新增歌曲
     * 
     * @param playerSong 歌曲
     * @return 结果
     */
    @Override
    public int insertPlayerSong(PlayerSong playerSong)
    {
        playerSong.setCreateTime(DateUtils.getNowDate());
        return playerSongMapper.insertPlayerSong(playerSong);
    }

    /**
     * 修改歌曲
     * 
     * @param playerSong 歌曲
     * @return 结果
     */
    @Override
    public int updatePlayerSong(PlayerSong playerSong)
    {
        return playerSongMapper.updatePlayerSong(playerSong);
    }

    /**
     * 批量删除歌曲
     * 
     * @param ids 需要删除的歌曲主键
     * @return 结果
     */
    @Override
    public int deletePlayerSongByIds(Long[] ids)
    {
        return playerSongMapper.deletePlayerSongByIds(ids);
    }

    /**
     * 删除歌曲信息
     * 
     * @param id 歌曲主键
     * @return 结果
     */
    @Override
    public int deletePlayerSongById(Long id)
    {
        return playerSongMapper.deletePlayerSongById(id);
    }

    /**
     * @description 获取最新单曲
     * @author lvyq

     * @throws
     * @return List<Map<Object>>
     * @time 2025-04-15 17:03
     */
    @Override
    public List<Map<String, Object>> getNewSong() {
        return playerSongMapper.getNewSong();
    }

    @Override
    public List<PlayerSong> selectPlayerSongPage(PlayerSong playerSong) {
        return playerSongMapper.selectPlayerSongPage(playerSong);
    }

    @Override
    public List<Map<String, Object>> search(String searchVal) {
        return playerSongMapper.search(searchVal);
    }
}
